package drrr.controller;

import com.opensymphony.xwork2.ActionSupport;
import drrr.orm.Service;

/**
 * Created by Xun on 2015/5/27.
 */
public class AjaxSend extends ActionSupport {
    private String content;
    private long timestamp;
    private int userid;
    private int roomid;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public int getUserid() {
        return userid;
    }

    public void setUserid(int userid) {
        this.userid = userid;
    }

    public int getRoomid() {
        return roomid;
    }

    public void setRoomid(int roomid) {
        this.roomid = roomid;
    }

    public void send() {
        String sql = String.format(
                "insert into roomchatlist (roomid,userid,content) values(%d,%d,'%s')",
                getRoomid(), getUserid(), getContent());
        Service.execute(sql);
    }
}
